*===================================================================================================================
* This is a do-file for "Rivals Within: Political Factions, Loyalty and Elite Competition under Authoritarianism."
*(Stata 14 or plus is necessary)
*===================================================================================================================
reghdfe, compile

***********
* Table 1 *
***********

** Corruption News, Party Secretaries **
use "news_regressions_clear.dta", clear
 
eststo clear
* absolute number
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11 & pg==1, ab(year en) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
* all news
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
* ratio
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction  if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction  nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction  nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)

esttab, order (samefaction pgnfaction pgefaction agegap yiogap lngdppcgap) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001) replace  
 
 
***********
* Table 2 *
***********
** Corruption News, Pooled (Party Secretaries and Governors)**
use "news_regressions_clear.dta", clear

eststo clear
* absolute number
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
* all news
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
* ratio
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)

esttab, keep (samefaction) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001) replace  
 
 
***********
* Table 3 *
***********
** Safety Accident, Party Secretaries
use "news_regressions_clear.dta", clear

eststo clear
* absolute number
eststo clear
eststo: qui reghdfe safetyreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
eststo: qui reghdfe safetyreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
eststo: qui reghdfe safetyreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
* ratio
eststo: qui reghdfe safetyreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
eststo: qui reghdfe safetyreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)
eststo: qui reghdfe safetyreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year en) vce(cluster en)

esttab, keep (samefaction) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001) replace  


***********
* Table 4 *
***********
** Promotion Analysis, Party Secretaries

use "promotion_regressions_clear.dta", clear

eststo clear
eststo: xi: qui reghdfe promote corruptioncases single multiple gdpgrowth lngdppop age age2 eduyear if year>1999 & ps==1 & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote corruptioncases corruptioncount reportcorruption single multiple gdpgrowth lngdppop age age2 eduyear if year>1999 & ps==1 & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote corruptioncases corruptioncount reportedsame reportcorruption reportingsame single multiple gdpgrowth lngdppop age age2 eduyear if year>1999 & ps==1 & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote corruptioncases corruptioncount_norm reportcorruption_norm single multiple gdpgrowth lngdppop age age2 eduyear if year>1999 & ps==1 & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote corruptioncases corruptioncount_norm reportedsame_norm reportcorruption_norm reportingsame_norm single multiple gdpgrowth lngdppop age age2 eduyear if year>1999 & ps==1 & province!=11, ab(province year) vce(r)

esttab, keep (corruptioncases corruptioncount reportcorruption reportedsame reportingsame corruptioncount_norm reportcorruption_norm reportedsame_norm reportingsame_norm) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001) replace 


**==========**
** APPENDIX **
**==========**

*************
* Table A.1 *
*************
** Descriptive Statistics
* ||Panel A||
use "news_regressions_clear.dta", clear
fsum corruptionreport safetyreport partylinecorruption comlinecorruption province_name_news if  newsprov!=11 & eventprov!=11 & pg==1, label format(%9.3f)
fsum agegap yiogap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if  newsprov!=11 & eventprov!=11 & pg==1, label  format(%9.3f)
fsum agegap yiogap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if  newsprov!=11 & eventprov!=11, label  format(%9.3f)
* ||Panel B||
use "promotion_regressions_clear.dta", clear
fsum promote2 lateral retire termination corruptioncases single multiple age age2 eduyear gdpgrowth lngdppop  if year>1999 & ps==1 & province!=11, label  format(%9.3f)


*************
* Table A.2 *
*************
** Local news paper list (English)


*************
* Table A.3 * 
*************
use "ps_gv_patron.dta", clear

eststo clear 	
**Connected to Party Secretaries
eststo: xi: reghdfe report i.ties homeprov workprov if ps==1, ab(py patrony)  vce(r)
eststo: xi: reghdfe report i.ties*ncpyear homeprov workprov if ps==1, ab(py patrony)  vce(r)
**Connected to Governors
eststo: xi: reghdfe report i.ties homeprov workprov if ps==0, ab(py patrony)   vce(r)
eststo: xi: reghdfe report i.ties*ncpyear homeprov workprov if ps==0, ab(py patrony)  vce(r)
label var _Ities_1 "Faction Ties"
label var _ItieXncpye_1 "Faction Ties X NCP Year"
label var homeprov "Patron's Hometown Province"
label var workprov "Patron's Workplace Province"
esttab, drop (ncpyear) label b(%12.3fc) se ar2 nogap  star(+ 0.10 * 0.05 ** 0.01 *** 0.001) order(_Ities_1 _ItieXncpye_1 homeprov workprov)  


*************
* Table A.4 *
*************
** Poisson Regression
use "news_regressions_clear.dta", clear

set matsize 11000
** Party Sec **
eststo clear
* absolute number
eststo: qui poisson corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11 & pg==1, vce(cluster en)
eststo: qui poisson corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11 & pg==1, vce(cluster en)
eststo: qui poisson corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11 & pg==1 , vce(cluster en)
* all news
eststo: qui poisson province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11 & pg==1, vce(cluster en)
eststo: qui poisson province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11 & pg==1, vce(cluster en) 
eststo: qui poisson province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11 & pg==1, vce(cluster en) 

** Pooled **

* absolute number
eststo: qui poisson corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11, vce(cluster en) 
eststo: qui poisson corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11, vce(cluster en) 
eststo: qui poisson corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11, vce(cluster en) 
* all news
eststo: qui poisson province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11, vce(cluster en) 
eststo: qui poisson province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11, vce(cluster en) 
eststo: qui poisson province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 i.eventprov i.year i.newsprov if newsprov!=11 & eventprov!=11, vce(cluster en) 

esttab, order(samefaction pgnfaction pgefaction agegap yiogap lngdppcgap) keep(samefaction pgnfaction pgefaction agegap yiogap lngdppcgap  province_name_news nfactionno efactionno bfactionno nfaction1 nfaction2 efaction1 efaction2) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001)  
 

*************
* Table A.5 *
*************
** Full Table for Table 2: Party Secretaries and Governors **
use "news_regressions_clear.dta", clear

eststo clear
* absolute number
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
* all news
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
* ratio
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)

esttab, order (samefaction pgnfaction pgefaction agegap yiogap lngdppcgap) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001)  
 

*************
* Table A.6 *
************* 
** Governor ** 
use "news_regressions_clear.dta", clear

eststo clear
*  absolute number
eststo: qui reghdfe corruptionreport gnagegap gnyiogap lngdppcgap gnsamefaction pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11 & pg==2,  ab(year  en) vce(cluster en)
eststo: qui reghdfe corruptionreport gnagegap gnyiogap lngdppcgap gnsamefaction pgnfaction pgefaction province_name_news ngnfactionno egnfactionno bgnfactionno if newsprov!=11 & eventprov!=11 & pg==2,  ab(year  en) vce(cluster en)
eststo: qui reghdfe corruptionreport gnagegap gnyiogap lngdppcgap gnsamefaction pgnfaction pgefaction province_name_news ngnfaction1 ngnfaction2 egnfaction1 egnfaction2 if newsprov!=11 & eventprov!=11 & pg==2,  ab(year  en) vce(cluster en)
*  all news
eststo: qui reghdfe province_name_news gnagegap gnyiogap lngdppcgap gnsamefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11 & pg==2,  ab(year  en) vce(cluster en)
eststo: qui reghdfe province_name_news gnagegap gnyiogap lngdppcgap gnsamefaction pgnfaction pgefaction ngnfactionno egnfactionno bgnfactionno if newsprov!=11 & eventprov!=11 & pg==2,  ab(year  en) vce(cluster en)
eststo: qui reghdfe province_name_news gnagegap gnyiogap lngdppcgap gnsamefaction pgnfaction pgefaction ngnfaction1 ngnfaction2 egnfaction1 egnfaction2 if newsprov!=11 & eventprov!=11 & pg==2,  ab(year  en) vce(cluster en)
* ratio
eststo: qui reghdfe corruptionreport_norm gnagegap gnyiogap lngdppcgap gnsamefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11 & pg==2,  ab(year  en) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm gnagegap gnyiogap lngdppcgap gnsamefaction pgnfaction pgefaction ngnfactionno egnfactionno bgnfactionno  if newsprov!=11 & eventprov!=11 & pg==2,  ab(year  en) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm gnagegap gnyiogap lngdppcgap gnsamefaction pgnfaction pgefaction ngnfaction1 ngnfaction2 egnfaction1 egnfaction2 if newsprov!=11 & eventprov!=11 & pg==2,  ab(year  en) vce(cluster en)

esttab, order (gnsamefaction pgnfaction pgefaction gnagegap gnyiogap lngdppcgap) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001)  
 
  
*************
* Table A.7 *
*************
** Full Table for Table 3: Safety Accident, Party Secretaries  
use "news_regressions_clear.dta", clear

eststo clear
* absolute number
eststo clear
eststo: qui reghdfe safetyreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe safetyreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe safetyreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
* ratio
eststo: qui reghdfe safetyreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe safetyreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe safetyreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)

esttab, order (samefaction pgnfaction pgefaction agegap yiogap lngdppcgap) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001)  


*************
* Table A.8 *
************* 
** Safety Accident, Party Secretaries and Governors
use "news_regressions_clear.dta", clear

*  absolute number
eststo clear
eststo: qui reghdfe safetyreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe safetyreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe safetyreport agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
*  ratio 
eststo: qui reghdfe safetyreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe safetyreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)
eststo: qui reghdfe safetyreport_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11,  ab(year en pg) vce(cluster en)

esttab, order (samefaction pgnfaction pgefaction agegap yiogap lngdppcgap) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001)  


*************
* Table A.9 *
************* 
** Event Province-Year Fixed Effects (Table 1 Replicated)
** Party Secretaries **
use "news_regressions_clear.dta", clear

eststo clear
* absolute number
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction province_name_news if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprovyr newsprov en) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction province_name_news nfactionno efactionno if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprovyr newsprov en) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction province_name_news nfaction1 nfaction2 if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprovyr newsprov en) vce(cluster en)
* all news
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprovyr newsprov en) vce(cluster en)
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction nfactionno efactionno if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprovyr newsprov en) vce(cluster en)
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction nfaction1 nfaction2 if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprovyr newsprov en) vce(cluster en)
* ratio
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprovyr newsprov en) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction nfactionno efactionno if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprovyr newsprov en) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction nfaction1 nfaction2 if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprovyr newsprov en) vce(cluster en)

esttab, order (samefaction pgnfaction pgefaction agegap yiogap lngdppcgap) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001) 
 
 
**************
* Table A.10 *
************** 
** Event Province-Year Fixed Effects (Table 2 Replicated)
** Pooled (Party Secretaries and Governors)**
use "news_regressions_clear.dta", clear

eststo clear
* absolute number
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction province_name_news if newsprov!=11 & eventprov!=11, ab(eventprovyr newsprov en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction province_name_news nfactionno efactionno if newsprov!=11 & eventprov!=11, ab(eventprovyr newsprov en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction pgnfaction province_name_news nfaction1 nfaction2 if newsprov!=11 & eventprov!=11, ab(eventprovyr newsprov en pg) vce(cluster en)
* all news
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction if newsprov!=11 & eventprov!=11, ab(eventprovyr newsprov en pg) vce(cluster en)
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction nfactionno efactionno if newsprov!=11 & eventprov!=11, ab(eventprovyr newsprov en pg) vce(cluster en)
eststo: qui reghdfe province_name_news agegap yiogap lngdppcgap samefaction pgnfaction nfaction1 nfaction2 if newsprov!=11 & eventprov!=11, ab(eventprovyr newsprov en pg) vce(cluster en)
* ratio
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction if newsprov!=11 & eventprov!=11, ab(eventprovyr newsprov en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction nfactionno efactionno if newsprov!=11 & eventprov!=11, ab(eventprovyr newsprov en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction pgnfaction nfaction1 nfaction2 if newsprov!=11 & eventprov!=11, ab(eventprovyr newsprov en pg) vce(cluster en)

esttab,   order (samefaction pgnfaction agegap yiogap lngdppcgap) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001) 

**************
* Table A.11 *
**************

** Partyline versus Commercial-line Newspapers, Party Secretaries **
use "news_regressions_clear.dta", clear

eststo clear
** Partyline Newspapers
* absolute number
eststo: qui reghdfe partylinecorruption agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe partylinecorruption agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe partylinecorruption agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
* ratio
eststo: qui reghdfe partylinecorruption_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe partylinecorruption_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe partylinecorruption_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
** Commercial-line Newspapers
* absolute number
eststo: qui reghdfe comlinecorruption agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe comlinecorruption agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe comlinecorruption agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
* ratio
eststo: qui reghdfe comlinecorruption_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe comlinecorruption_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe comlinecorruption_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)

esttab, order(samefaction pgnfaction pgefaction agegap yiogap lngdppcgap nfactionno efactionno bfactionno nfaction1 nfaction2 efaction1 efaction2) keep(samefaction pgnfaction pgefaction agegap yiogap lngdppcgap nfactionno efactionno bfactionno nfaction1 nfaction2 efaction1 efaction2 province_name_news) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001) 
 

**************
* Table A.12 *
************** 
** Alternative keyword (luoma+fubai)
** Party Secretaries **
use "news_regressions_clear.dta", clear

eststo clear
* absolute number
eststo: qui reghdfe luoma agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe luoma agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno  if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe luoma agegap yiogap lngdppcgap samefaction pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
* ratio
eststo: qui reghdfe luoma_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe luoma_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe luoma_norm agegap yiogap lngdppcgap samefaction pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
 
esttab, order (samefaction pgnfaction pgefaction agegap yiogap) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001)  
 

**************
* Table A.13 *
************** 
** Xi period 
use "news_regressions_clear.dta", clear

** Party Secretaries **
eststo clear
* absolute number
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprov  newsprov en) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprov   newsprov en) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprov   newsprov en) vce(cluster en)
* ratio
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction if newsprov!=11 & eventprov!=11 & pg==1,  ab(year  en) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprov  newsprov en) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11 & pg==1, ab(eventprov   newsprov en) vce(cluster en)

** Pooled **
* absolute number
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction province_name_news if newsprov!=11 & eventprov!=11, ab(eventprov  newsprov en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction province_name_news nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11, ab(eventprov  newsprov en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction province_name_news nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11, ab(eventprov   newsprov en pg) vce(cluster en)
* ratio
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction if newsprov!=11 & eventprov!=11, ab(eventprov   newsprov en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction nfactionno efactionno bfactionno if newsprov!=11 & eventprov!=11, ab(eventprov   newsprov en pg) vce(cluster en)
eststo: qui reghdfe corruptionreport_norm agegap yiogap lngdppcgap samefaction xi same_xi pgnfaction pgefaction nfaction1 nfaction2 efaction1 efaction2 if newsprov!=11 & eventprov!=11, ab(eventprov   newsprov en pg) vce(cluster en)

label variable same_xi "Same Faction * Post-18th NPC"
label variable xi "Post-18th NPC Leadership" 

esttab, order (samefaction xi same_xi pgnfaction pgefaction agegap yiogap) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001)  
 
**************
* Table A.14 *
**************  
** Promotion pooled (party secretaries & governors) 
use "promotion_regressions_clear.dta", clear

eststo clear
eststo: xi: qui reghdfe promote corruptioncases single multiple gdpgrowth lngdppop age age2 eduyear if year>1999   & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote corruptioncases corruptioncount reportcorruption single multiple gdpgrowth lngdppop age age2 eduyear if year>1999   & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote corruptioncases corruptioncount reportedsame reportcorruption reportingsame single multiple gdpgrowth lngdppop age age2 eduyear if year>1999  & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote corruptioncases corruptioncount_norm reportcorruption_norm single multiple gdpgrowth lngdppop age age2 eduyear if year>1999  & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote corruptioncases corruptioncount_norm reportedsame_norm reportcorruption_norm reportingsame_norm single multiple gdpgrowth lngdppop age age2 eduyear if year>1999  & province!=11, ab(province year) vce(r)

esttab, keep (corruptioncases corruptioncount reportcorruption reportedsame reportingsame corruptioncount_norm reportcorruption_norm reportedsame_norm reportingsame_norm) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001) 


**************
* Table A.15 *
************** 
** binary promotion
use "promotion_regressions_clear.dta", clear

eststo clear
eststo: xi: qui reghdfe promote2 corruptioncases single multiple gdpgrowth lngdppop age age2 eduyear if year>1999 & ps==1 & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote2 corruptioncases corruptioncount reportcorruption single multiple gdpgrowth lngdppop age age2 eduyear if year>1999 & ps==1 & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote2 corruptioncases corruptioncount reportedsame reportcorruption reportingsame single multiple gdpgrowth lngdppop age age2 eduyear if year>1999 & ps==1 & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote2 corruptioncases corruptioncount_norm reportcorruption_norm single multiple gdpgrowth lngdppop age age2 eduyear if year>1999 & ps==1 & province!=11, ab(province year) vce(r)
eststo: xi: qui reghdfe promote2 corruptioncases corruptioncount_norm reportedsame_norm reportcorruption_norm reportingsame_norm single multiple gdpgrowth lngdppop age age2 eduyear if year>1999 & ps==1 & province!=11, ab(province year) vce(r)

esttab, keep (corruptioncases corruptioncount reportcorruption reportedsame reportingsame corruptioncount_norm reportcorruption_norm reportedsame_norm reportingsame_norm) label b(%12.3fc) se ar2 nogap star(+ 0.10 * 0.05 ** 0.01 *** 0.001)  



**************
* Table A.16 *
************** 
** Beijing newspapers 
use "news_regressions_clear.dta", clear

eststo clear
eststo: qui reghdfe corruptionreport totalreportcorruption corrbigcase if newsprov==11 & eventprov!=11, ab(eventprov year) vce(r)
eststo: qui reghdfe safetyreport totalreportsafety safetytolls if newsprov==11 & eventprov!=11, ab(eventprov year) vce(r)
eststo: qui reghdfe corruptionreport totalreportcorruption1 corrbigcase if newsprov==11 & eventprov!=11, ab(eventprov year) vce(r)
eststo: qui reghdfe safetyreport totalreportsafety1 safetytolls if newsprov==11 & eventprov!=11, ab(eventprov year) vce(r)
eststo: qui reghdfe corruptionreport totalcorruptionreport corrbigcase if newsprov==11 & eventprov!=11, ab(eventprov year) vce(r)
eststo: qui reghdfe safetyreport totalsafetyreport safetytolls if newsprov==11 & eventprov!=11, ab(eventprov year) vce(r)

esttab, b(%12.3fc) se ar2 nogap label star(+ 0.10 * 0.05 ** 0.01 *** 0.001) order(corrbigcase safetytolls totalreportcorruption totalreportsafety totalreportcorruption1 totalreportsafety1 totalcorruptionreport totalsafetyreport) 
